forum

Home / DeveloperSection / Forums / Pass an object from controller to view with asp.net

Pass an object from controller to view with asp.net

Anonymous User 2086 29-Jan-2015

 need to pass an object from my controller to my view, I have the next code

public ActionResult General(int id)
    {
        List<Topics>topics = new List<Topics>();
        Topics top = new Topics();        List<string> items = new List<string>();
        topics = top.getAllTopics(id);
        for (int i = 0;i < topics.Count; i++)
        {
 
            items.Add(topics[i].name);
 
        }
        ViewBag.Items =items;
        return View(topics.Count);
    }

and I need use the value of topics.Count in my view and putting it in a for.


Updated on 29-Jan-2015
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By